home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12236 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.8 KB  |  67 lines

  1. Newsgroups: comp.lang.c++
  2. From: jgustafs@sisna.com (Josh Gustafson)
  3. Subject: Re: C++ Shortcomings ?
  4. Organization: Source Internet Services
  5. References: <31488E8D.167E@aw.sgi.com> <4iaqch$moh@B1FF.mindspring.com>
  6. X-Newsreader: News Xpress 2.0 Beta #0
  7. Date: Sat, 16 Mar 96 15:11:28 GMT
  8. NNTP-Posting-Host: dialup1114.sisna.com
  9. Message-ID: <314ac676.0@news.sisna.com>
  10. Path: news.sisna.com!DIALUP1114
  11.  
  12. In article <4iaqch$moh@B1FF.mindspring.com>, rudd@mindspring.com wrote:
  13. >Emmanuel Mogenet <mgix@aw.sgi.com> wrote:
  14. >>2. Pointer type manipulation
  15. >>-----------------------------
  16. >
  17. >>A very disappointing thing in C++ (unless I am mistaken and it is actually
  18. >>possible to do so) is the following situation:
  19. >
  20. >>If A is a class, then most operations on A can be redefined.
  21. >>Because A is a full blown type.
  22. >
  23. >>Sadly, the same can not be said about A* (type: pointer to A).
  24. >
  25. >>Even though A* is a type, none of its default manipulations
  26. >>can be redefined.
  27. >
  28. >>Example: You can tell C++, that you want to gain control of the
  29. >>situation whenever an object of type A is duplicated.
  30. >
  31. >>You do so by redefining the default copy constructor and the default
  32. >>assignment operator.
  33. >
  34. >>But can you tell C++ that you want to gain control whenever a pointer of
  35. >>A* is duplicated ? Why can't I redefine the copy constructor for the type A* ?
  36. >
  37. >>In my way of looking at thing, that'd be a *great* way of doing clean
  38. > reference
  39. >>counting, instead of half-baked method using a redefinition of operator->.
  40. >
  41. >>Comments ?
  42. >
  43. >Ok...so you are saying you can do something like this...
  44. >
  45. >A a1, a2;
  46. >
  47. >a1 = a2;
  48. >
  49. >But you want to be able to do this
  50. >
  51. >A a1, *a2;
  52. >
  53. >a1 = a2;
  54.  
  55. Actually, I think he means he wants to be able to do this:
  56.  
  57. A *a1, *a2;
  58.  
  59. a1 = a2;
  60.  
  61.  
  62. Sorry, though, no help here, I'm a newbie to OOP.  :-)
  63.  
  64.  
  65. --
  66. Josh Gustafson  (jgustafs@sisna.com)
  67.